//
//  GLInterpolator.m
//  LMPhotoVideoSDK
//
//  Created by Aimar on 16/7/19.
//  Copyright © 2016年 魁钺会. All rights reserved.
//

#import "GLInterpolator.h"

@implementation GLInterpolator

-(float)getInterpolation:(float)input {
    return input;
}

@end


@implementation GLLinearInterpolator

@end


@interface GLAccelerateInterpolator ()

@property (nonatomic, assign)float      factor;
@property (nonatomic, assign)float      doubleFactor;

@end

@implementation GLAccelerateInterpolator

- (id)init {
    self = [super init];
    if (self) {
        self.factor = 1;
        self.doubleFactor = 2 * self.factor;
    }
    
    return self;
}

- (id)initWithFactor:(float)factor {
    self = [super init];
    if (self) {
        self.factor = factor;
        self.doubleFactor = 2 * factor;
    }
    
    return self;
}

-(float)getInterpolation:(float)input {
    if (self.factor == 1.0f) {
        return input * input;
    } else {
        return (float)pow(input, self.doubleFactor);
    }
}

@end